Public OnTop As Boolean 'Whether form stays on top or not
' If Win16 evaluates as true,
#If Win16 Then
Declare Function mciExecute Lib "mmsystem" (ByVal lpstrCommand As String) As Integer
Declare Function mciSendString Lib "mmsystem" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hWndCallback As Integer) As Long
Declare Function mciGetErrorString Lib "mmsystem" (ByVal wError As Long, ByVal lpstrBuffer As String, ByVal uLength As Integer) As Integer
Declare Sub SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer)
Public Const SWP_NOSIZE As Integer = &H1
Public Const SWP_NOMOVE As Integer = &H2
Public Const HWND_TOPMOST As Integer = -1
Public Const HWND_NOTOPMOST As Integer = -2
' Otherwise, if it is a 32-bit Windows program,
#ElseIf Win32 Then
Declare Function mciExecute Lib "WINMM.DLL" (ByVal lpstrCommand As String) As Long
Declare Function mciSendString Lib "WINMM.DLL" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hWndCallback As Long) As Long
Declare Function mciGetErrorString Lib "WINMM.DLL" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Public Const SWP_NOSIZE As Long = &H1
Public Const SWP_NOMOVE As Long = &H2
Public Const HWND_TOPMOST As Long = -1
Public Const HWND_NOTOPMOST As Long = -2
#End If
Sub MMSend(cmd As String)
Dim Ret1%, Ret2&, MLen1%, MLen2&, Msg$, MErr$
'Use conditional compilation to control the value types being passed to the declares
Select Case SelOpt
Case 0 'MciExcute is selected
#If Win16 Then
Ret1 = mciExecute(cmd) '16-bit declare requires an integer
#ElseIf Win32 Then
Ret2 = mciExecute(cmd) '32-bit declare requires a long